# This script will run a single MCMC chain for the RWMH estimation ("Step 4").
# See README for details.

# This function makes sure we unset all the run instructions between runs
function unset_all() {
    export GLL_RECOMPUTE_DATA=0
    export GLL_ESTIMATE_RWMC=0
    export GLL_FIND_MODE=0
    export GLL_COMPUTE_HESSIAN=0
    export GLL_SAMPLE_RWMC=0
    export GLL_DRAW_STATES_RWMC=0
    export GLL_SIMULATE_RWMC=0
    export GLL_FITTED_VALUES_RWMC=0
    export GLL_MISC_RWMC=0
    export GLL_RWMC_COUNTERFACTUALS=0
    export GLL_RWMC_BOND_PRICING=0
    export GLL_RESULTS=0
    unset GLL_MCMC_CHAIN
}

pushd code

# Set spec number
spec=49
export GLL_SPEC_NO=$spec

# Run MCMC estimation for single chain
unset_all
export GLL_SAMPLE_RWMC=1
export GLL_DRAW_STATES_RWMC=1
export GLL_SIMULATE_RWMC=1
export GLL_FITTED_VALUES_RWMC=1
export GLL_MISC_RWMC=1

# Set single chain number
draw_states_rwmc
python main.py

popd
